#guangduyouxian.py
import os
map=(
(0,1,0,0,0,1,1,1,1,1),
(0,1,0,1,0,0,0,0,0,1),
(0,1,0,1,1,1,1,1,0,1),
(0,1,0,1,0,0,0,1,0,1),
(0,1,0,1,0,1,0,1,0,1),
(0,1,0,1,0,1,0,1,0,1),
(0,1,0,1,0,1,0,1,0,1),
(0,1,0,1,0,1,0,0,0,1),
(0,1,0,1,0,1,1,1,1,1),
(0,0,0,1,0,0,0,0,0,0),)
print(len(map))

startpoint,endpoint=(0,0),(9,9)

open=[]
fdome={}
close=[]
nowpoint=()
open.append(startpoint)
while open:
	point=open.pop(0)
	print(point)
	for x,y in ((-1,0),(1,0),(0,-1),(0,1)):
		nowpoint=(point[0]+x,point[1]+y)
		if nowpoint[0]<0 or nowpoint[0]>9 \
		or nowpoint[1]<0 or nowpoint[1]>9:
			continue
		print(nowpoint)
		#print(x,y)
		if map[nowpoint[0]][nowpoint[1]] or nowpoint in close:
			continue
		else:
			fdome[nowpoint]=point
			close.append(nowpoint)
			open.append(nowpoint)
	print('')
	if nowpoint == endpoint:
		break
	close.append(point)

else:
	print('无法到达！')
	exit()

#print(fdome)
echomap = []
for m in map:
	echomap.append(list(m))
while nowpoint != startpoint:
	echomap[nowpoint[0]][nowpoint[1]]='8'
	
	nowpoint=fdome.get(nowpoint)
echomap[startpoint[0]][startpoint[1]]='#'
echomap[endpoint[0]][endpoint[1]]='@'
for x in echomap:
	for y in x:
		if y ==0 :
			print(' ',end=' ')
		elif y == 1:
			print('|',end=' ')
		else:
			print(y,end=' ')
	print('')




